package InputPreparer;

import java.util.ArrayList;

import Definitions.NodeClass;
import Global.ConstantVariable;
import Global.GlobalClass;
import Sampling.SamplingAbstractClass;

public class ContentPreparerClass extends  InputPreparerClass{

	int contentType;
	
	public int getContentType() {
		return contentType;
	}
	public void setContentType(int contentType) {
		this.contentType = contentType;
	}
	public ContentPreparerClass(SamplingAbstractClass currentSampling, GlobalClass global)
	{
		super(currentSampling, global);
		this.name =ConstantVariable.InputPreparer_Constants.CONTENT_INPUT;
		this.contentType=0;
	}
	public ContentPreparerClass(int contentType, SamplingAbstractClass currentSampling, GlobalClass global) {
		super(currentSampling, global);
		System.out.println("content Constructor");
		this.contentType =contentType;
	}
	
	
	public ArrayList <Double> getInput(NodeClass u, int stage)
	{	
		
		ArrayList<Double> input =new ArrayList<Double>();
		
		
		
		for(int i=0;  i<u.getContentList().get(this.contentType).getAttributeList().size() ;i ++) 
		{
			input.add((double) u.getContentList().get(this.contentType).getAttributeList().get(i));
		}
		
		return input;
	}
	
	public static void Test(NodeClass u, SamplingAbstractClass currentSampling, GlobalClass global)
	{
		ContentPreparerClass prep = new ContentPreparerClass(currentSampling, global);
		ArrayList<Double> list = prep.getInput(u, ConstantVariable.Sampling_Constants.NODE_IS_IN_TEST_SET_FOR_THE_FOLD);
		
		for(int i=0 ; i<list.size() ;i++)
		{
			if(list.get(i)!= (double)u.getContentList().get(0).getAttributeList().get(i))
			{
				System.out.println("False ");
			}
		}
		
		System.out.println("Content Input Test Result :");
		for(Double f : list )
		{
			System.out.print(f+"  ");
		}
			
		System.out.println();
	}
	
}
